package dataStruct.graph;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

/**
 * Created by thinkpad on 2016/3/20.
 */

//1----2----3
// 10    15
//    30
public class GraphTest {
    public static void main(String[] args){
        List<String> nodes = new ArrayList<String>();
        final String node1 = "1";
        final String node2 = "2";
        final String node3 = "3";

        nodes.add(node1);
        nodes.add(node2);
        nodes.add(node3);

        ConcurrentMap<AsKey,Long> asMap = new ConcurrentHashMap<AsKey, Long>();
        asMap.put(new AsKey(node1, node1), 0L);
//        asMap.put(new AsKey(node1, node2), 10L);
        asMap.put(new AsKey(node1, node2), Long.MAX_VALUE);
        asMap.put(new AsKey(node1, node3), 20L);
        asMap.put(new AsKey(node2, node2), 0L);
        asMap.put(new AsKey(node2, node3), 15L);
        asMap.put(new AsKey(node2, node1), Long.MAX_VALUE);
        asMap.put(new AsKey(node3, node1), Long.MAX_VALUE);
        asMap.put(new AsKey(node3, node2), Long.MAX_VALUE);
        asMap.put(new AsKey(node3, node3), 0L);


        Graph graph = new Graph(nodes, asMap);
        graph.shortPath("1");
    }
}
